#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<map>
#define int long long 
#define x first 
#define y second 
using namespace std;
const int N = 1e5 +10;
int a[N];
int res = 0;
int count(int a[],int n)
{
      int cnt = 1;
      for(int i = 1; i <= n; i++)
      {
         cnt = (cnt * (a[i] % 10)) % 10; 
         if(cnt == 6) res++;
      }
      return res;
}
void solve()
{
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++) cin >>  a[i];
    cout << count(a,n) <<endl; 
}
signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    int t = 1;
    while(t--) solve();
    return 0;
}